package hu.crs.demobank.user;

import hu.crs.demobank.backend.DbOperations;

import java.util.Arrays;

public class UserManager {
	private User user;

	public static User initUser(String userName) throws Exception {
		User user = new User(userName);
		Integer userId = DbOperations.getLoginID(userName);
		String account = DbOperations.getAccountNumber(userId);
		user.setUserId(userId);
		user.setAccounts(Arrays.asList(account));
		return user;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
